﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

namespace ArgusLib.Fractals.OrbitFractals
{
	public struct ComplexArea
	{
		public double CenterRe { get; set; }
		public double CenterIm { get; set; }
		public double Width { get; set; }
		public double Height { get; set; }
		public double Rotation { get; set; }

		public Complex Center
		{
			get { return new Complex(this.CenterRe, this.CenterIm); }
			set
			{
				this.CenterRe = value.Real;
				this.CenterIm = value.Imaginary;
			}
		}
		public Complex TopLeft
		{
			get
			{
				Complex c = new Complex(-this.Width / 2, this.Height / 2);
				c = c * Complex.FromPolarCoordinates(1, this.Rotation);
				return this.Center + c;
			}
		}

		public Complex TopRight
		{
			get
			{
				Complex c = new Complex(this.Width / 2, this.Height / 2);
				c = c * Complex.FromPolarCoordinates(1, this.Rotation);
				return this.Center + c;
			}
		}

		public Complex BottomLeft
		{
			get
			{
				Complex c = new Complex(-this.Width / 2, -this.Height / 2);
				c = c * Complex.FromPolarCoordinates(1, this.Rotation);
				return this.Center + c;
			}
		}

		public Complex BottomRight
		{
			get
			{
				Complex c = new Complex(this.Width / 2, -this.Height / 2);
				c = c * Complex.FromPolarCoordinates(1, this.Rotation);
				return this.Center + c;
			}
		}
	}
}
